<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>文章列表--layui后台管理模板 2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="../../css/public.css" media="all" />
    <style>
        #spans {
            display: none
        }
    </style>
</head>

<body class="childrenBody">
    <form class="layui-form layui-row layui-col-space10">
        <div class="layui-col-md9 layui-col-xs12">
            <div class="layui-row layui-col-space10">
                <div class="layui-col-md12 layui-col-xs12">
                    <div class="layui-form-item magt3">
                        <label class="layui-form-label">公司名称</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input newsName company_name" lay-verify="newsName" placeholder="请输入公司名称">
                        </div>
                    </div>
                    <div class="layui-form-item magt3">
                        <label class="layui-form-label">职位名称</label>
                        <div class="layui-input-block">
                            <input type="text" id="zhiwei" class="layui-input newsName job_position" lay-verify="newsName" placeholder="请输入职位名称">
                        </div>
                    </div>
                    <div class="layui-form-item magt3">
                        <label class="layui-form-label">招聘标题</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input newsName title" lay-verify="newsName" placeholder="简要概括招聘">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">职位描述</label>
                        <div class="layui-input-block">
                            <textarea placeholder="请输入职位描述" class="layui-textarea abstract describle"></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">岗位要求</label>
                        <div class="layui-input-block">
                            <textarea placeholder="请输入岗位要求" class="layui-textarea abstract require"></textarea>
                        </div>
                        <input type="text" id="spans" name="" id="">
                    </div>
                </div>
                <div class="layui-col-md12 layui-col-xs12">
                    <div class="layui-form-item magt3">
                        <div class="layui-form-item">
                            <label class="layui-form-label">选择地区</label>
                            <div class="layui-input-inline">
                                <select name="provid" id="provid" lay-filter="provid">
										<option value="">请选择省</option>
									</select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="cityid" id="cityid" lay-filter="cityid">
										<option value="">请选择市</option>
									</select>
                            </div>
                            <div class="layui-input-inline">
                                <select name="areaid" id="areaid" lay-filter="areaid">
										<option value="">请选择县/区</option>
									</select>
                            </div>
                        </div>
                    </div>
                </div>
                <!--隐藏input-->
                <div id="inputDiv">
                    <input type="hidden" name="" id="providInput" value="" />
                    <input type="hidden" name="" id="cityidInput" value="" />
                    <input type="hidden" name="" id="areaidInput" value="" />
                </div>
                <!-- <div class="layui-col-md3 layui-col-xs5">
                    <div class="layui-upload-list thumbBox mag0 magt3">
                        <img class="layui-upload-img thumbImg">
                    </div>
                </div> -->
            </div>
            <!-- <div class="layui-form-item magb0">
                <label class="layui-form-label">文章内容</label>
                <div class="layui-input-block">
                    <textarea class="layui-textarea layui-hide" name="content" lay-verify="content" id="news_content"></textarea>
                </div>
            </div> -->
        </div>
        <div class="layui-col-md3 layui-col-xs12">
            <!-- <blockquote class="layui-elem-quote title"><i class="seraph icon-caidan"></i> 职位分类</blockquote>
            <div class="border category">
                <div class="">
                    <p><input type="checkbox" name="news" title="计算机" lay-skin="primary" /></p>
                    <p><input type="checkbox" name="goods" title="销售" lay-skin="primary" /></p>
                    <p><input type="checkbox" name="notice" title="金融" lay-skin="primary" /></p>
                    <p><input type="checkbox" name="images" title="律师" lay-skin="primary" /></p>
                </div>
            </div> -->
            <blockquote class="layui-elem-quote title magt10"><i class="layui-icon">&#xe609;</i> 发布</blockquote>
            <div class="border">
                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="layui-icon">&#xe60e;</i> 状　态</label>
                    <div class="layui-input-block newsStatus">
                        <select class="status" name="status" lay-verify="required">
								<option value="1">立即发布</option>
								<option value="0">存为草稿</option>
							</select>
                    </div>
                </div>
                <!-- <div class="layui-form-item">
                    <label class="layui-form-label"><i class="layui-icon">&#xe609;</i> 发　布</label>
                    <div class="layui-input-block">
                        <input type="radio" name="release" title="立即发布" lay-skin="primary" lay-filter="release" checked />
                        <input type="radio" name="release" title="定时发布" lay-skin="primary" lay-filter="release" />
                    </div>
                </div> -->
                <div class="layui-form-item layui-hide releaseDate">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-block">
                        <input type="text" class="layui-input" id="release" placeholder="请选择日期和时间" readonly />
                    </div>
                </div>
                <!-- <div class="layui-form-item openness">
                    <label class="layui-form-label"><i class="seraph icon-look"></i> 公开度</label>
                    <div class="layui-input-block">
                        <input type="radio" name="openness" title="开放浏览" lay-skin="primary" checked />
                        <input type="radio" name="openness" title="私密浏览" lay-skin="primary" />
                    </div>
                </div> -->
                <!-- <div class="layui-form-item newsTop">
                    <label class="layui-form-label"><i class="seraph icon-zhiding"></i> 置　顶</label>
                    <div class="layui-input-block">
                        <input type="checkbox" name="newsTop" lay-skin="switch" lay-text="是|否">
                    </div>
                </div> -->
                <hr class="layui-bg-gray" />
                <div class="layui-right">
                    <a class="layui-btn layui-btn-sm" lay-filter="addNews" lay-submit><i class="layui-icon">&#xe609;</i>发布</a>
                    <!-- <a class="layui-btn layui-btn-primary layui-btn-sm" lay-filter="look" lay-submit>预览</a> -->
                </div>
            </div>
        </div>
    </form>
    <!--<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>-->
    <script type="text/javascript" src="../../layui/layui.js"></script>

    <script type="text/javascript" src="../../assets/data.js"></script>
    <script type="text/javascript" src="../../assets/province.js"></script>

    <script type="text/javascript" src="../../js/common.js"></script>
    <script type="text/javascript" src="editNews.js"></script>


</body>
<script type="text/javascript">
    window.onload = function() {
        console.log("新的页面")
        var defaults = {
            s1: 'provid',
            s2: 'cityid',
            s3: 'areaid',
            v1: '',
            v2: '',
            v3: ''
        };
        var $form;
        var form;
        var $;
        layui.define(['jquery', 'form'], function() {
            $ = layui.jquery;
            form = layui.form;
            $form = $('form');
            treeSelect(defaults);
        });

        function treeSelect(config) {
            config.v1 = $("#inputDiv #providInput").val();
            config.v2 = $("#inputDiv #cityidInput").val();
            config.v3 = $("#inputDiv #areaidInput").val();
            console.log($("#inputDiv #providInput").val())
            $.each(threeSelectData, function(k, v) {
                appendOptionTo($form.find('select[name=' + config.s1 + ']'), k, k, config.v1);
            });
            form.render();
            cityEvent(config);
            areaEvent(config);
            form.on('select(' + config.s1 + ')', function(data) {
                cityEvent(data);
                form.on('select(' + config.s2 + ')', function(data) {
                    areaEvent(data);
                });
            });

            function cityEvent(data) {
                $form.find('select[name=' + config.s2 + ']').html("");
                config.v1 = data.value ? data.value : config.v1;
                $.each(threeSelectData, function(k, v) {
                    if (k == config.v1) {
                        if (v.items) {
                            $.each(v.items, function(kt, vt) {
                                appendOptionTo($form.find('select[name=' + config.s2 + ']'), kt, kt, config.v2);
                            });
                        }
                    }
                });
                form.render();
                config.v2 = $('select[name=' + config.s2 + ']').val();
                areaEvent(config);
            }

            function areaEvent(data) {
                $form.find('select[name=' + config.s3 + ']').html("");
                config.v2 = data.value ? data.value : config.v2;
                $.each(threeSelectData, function(k, v) {
                    if (k == config.v1) {
                        if (v.items) {
                            $.each(v.items, function(kt, vt) {
                                if (kt == config.v2) {
                                    $.each(vt.items, function(ka, va) {
                                        appendOptionTo($form.find('select[name=' + config.s3 + ']'), ka, ka, config.v3);
                                    });
                                }
                            });
                        }
                    }
                });
                form.render();
                form.on('select(' + config.s3 + ')', function(data) {});
            }

            function appendOptionTo($o, k, v, d) {
                var $opt = $("<option>").text(k).val(v);
                if (v == d) {
                    $opt.attr("selected", "selected")
                }
                $opt.appendTo($o);
            }
        }
    }
</script>

</html>